//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//

package com.lyyzoo.util;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Regexs {
    public static final String number = "[0-9]*";
    public static final String number_int_positive = "^[1-9]d*$";
    public static final String ch = "^[一-龥]+$";
    public static final String email = "^([a-zA-Z0-9_\\-\\.]+)@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.)|(([a-zA-Z0-9\\-]+\\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$";
    public static final String email_msg = "邮箱填写错误";
    public static final String ip = "\\b((?!\\d\\d\\d)\\d+|1\\d\\d|2[0-4]\\d|25[0-5])\\.((?!\\d\\d\\d)\\d+|1\\d\\d|2[0-4]\\d|25[0-5])\\.((?!\\d\\d\\d)\\d+|1\\d\\d|2[0-4]\\d|25[0-5])\\.((?!\\d\\d\\d)\\d+|1\\d\\d|2[0-4]\\d|25[0-5])\\b";
    public static final String mobile = "^((13\\d{2})|14[579]\\d|(15[^4]\\d)|(17[^249]\\d)|(18\\d{2}))\\d{7}$";
    public static final String url = "\\b(https?|ftp|file)://[-a-zA-Z0-9+&@#/%?=~_|!:,.;]*[-a-zA-Z0-9+&@#/%=~_|]";

    public Regexs() {
    }

    public static boolean is(String str, String regexType) {
        Pattern p = Pattern.compile(regexType);
        Matcher m = p.matcher(str);
        return m.matches();
    }

    public static boolean isNumber(String str) {
        return is(str, "[0-9]*");
    }

    public static boolean isEmail(String str) {
        return is(str, "^([a-zA-Z0-9_\\-\\.]+)@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.)|(([a-zA-Z0-9\\-]+\\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$");
    }

    public static boolean isIP(String str) {
        return is(str, "\\b((?!\\d\\d\\d)\\d+|1\\d\\d|2[0-4]\\d|25[0-5])\\.((?!\\d\\d\\d)\\d+|1\\d\\d|2[0-4]\\d|25[0-5])\\.((?!\\d\\d\\d)\\d+|1\\d\\d|2[0-4]\\d|25[0-5])\\.((?!\\d\\d\\d)\\d+|1\\d\\d|2[0-4]\\d|25[0-5])\\b");
    }

    public static boolean isMobile(String str) {
        return is(str, "^((13\\d{2})|14[579]\\d|(15[^4]\\d)|(17[^249]\\d)|(18\\d{2}))\\d{7}$");
    }

    public static boolean isUrl(String str) {
        return is(str, "\\b(https?|ftp|file)://[-a-zA-Z0-9+&@#/%?=~_|!:,.;]*[-a-zA-Z0-9+&@#/%=~_|]");
    }
}
